package com.xm.hiber;


import com.xm.hiber.dao.InstructorDao;
import com.xm.hiber.entity.Course;
import com.xm.hiber.entity.Instructor;



public class App {
    public static void main(String[] args) {

        InstructorDao instructorDao = new InstructorDao();

        Instructor instructor = new Instructor("Ramesh", "Fadatare", "ramesh@javaguides.com");
        instructorDao.saveInstructor(instructor);

        // create some courses
        Course tempCourse1 = new Course("Learn Spring Boot");
        instructor.getCourses().add(tempCourse1);

        Course tempCourse2 = new Course("Learn hibernate");
        instructor.getCourses().add(tempCourse2);

        instructorDao.saveInstructor(instructor);
        // 为什么此处的courses为空？
        System.out.println(instructorDao.getInstructor(1));
        System.out.println(instructorDao.getInstructor(1).getCourses());
    }
}
